<?php

	$id = $_GET['id'];
	$data=mangaf2_get_manga($id);
	if($_SESSION['user']){
		$model = new model();
		$model->select = "id";
		$model->where = "truyen_id = '" . $id . "' AND username='" . $_SESSION['user']['username'] . "'";
		$model->getdata('truyen_history');
		$resultHistory = $model->fetchOne();
	
		if($resultHistory){
			$data['is_followed'] = true;
		}else{
			$data['is_followed'] = false;
		}
	}
	if($data['adult']==1){
		header("HTTP/1.0 404 Not Found");
		echo " Noi dung khong ton tai";
		exit();
	}
	
	//echo $data['tag3'];
	//
	
	//$data['chuong_list']=cache_get_truyen_chuong_list($id,1);
 //get the loai truyen cung tac gia ----------
 //query facebook, udpate sau
 /*
	$fb=new shareCount(url_truyen($data['id'],$data['alias']));
	$count=$fb->get_fb();
	$db=new db;
	$db->connect();
	$db->nonquery("update truyen set likes=".$count['like']." , comments=".$count['comment']." where id=$id");
	$db->close();
	*/
// End get truyen cung tac gia-------

   	//Lay the loai 2, lay duoc list chuong, update view, update so chuong hien co,update view
	
	//HEADER TITLE,KEYWORD,DESCRIPION
	/*
	$data1['title']="Đọc truyện ".encode($data['name']);
	$data1['mota']=short_str($data['noidung'],150);
	$data1['keyword']=$data['name'].",".$data['alias'].", xem manga ".$data['name'].",doc truyen ".$data['name']." full,".$data['name']." tron bo";
	*/
	$data1=mangaf2_generate_tags("manga",$data['name']);
		$og='<meta property="og:type" content="film" />
<meta property="og:image" content="'.$data['hinhanh'].'"/>
<meta property="og:locale" content="vi_VN" /> 
<meta property="og:title" content="Đọc Truyện '.$data['name'].' Tiếng Việt"/>
<meta property="og:description" content=" '.encode($data['noidung']).'"/> 
<meta property="og:url" content="'.url().'"/> ';
   $data1['og']=$og;
loadview('template/header2',$data1);
loadview("anime/view",$data);
loadview('template/footer2',$data1);

 //    loadview("template/right",$right);
exit();
?>